<%@ page contentType="text/html; charset=utf-8"%>
<%@ include file="../../../common/include.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>费用汇总上报</title>
<jsp:include page="../../../common/head.jsp">
	  <jsp:param name="_useCalendar" value="true"/>
</jsp:include>
<script language="javascript">
	function saveData(){
		var objarr = new Array(
			["feeReport.feeReportCode","编号","notEmpty",""],
			["feeReport.areaId","地区","notEmpty",""],
			["feeReport.areaDeptId","事业部","notEmpty",""]
		);
		if(xj.CheckAll(objarr))
		{
			if(confirm("确认保存？"))
			{
				document.getElementById("form1").submit();
			}
		}
	}

	//返回
	function goback()
	{
		window.top.close();
	}

	//将select的option的text放入hidden
	function selectOption(objSelect,hiddenId)
	{
		$("#"+hiddenId).val($(objSelect).find("option:selected").text());
		sumFee();
	}

	$.ready = function()
	{
		$("#feeReportYear").val("${wfn:getDateTime('yyyy')}");
	}
	//获取当前所选条件汇总数
	function sumFee()
	{
		var areaId = $("#areaId").find("option:selected").val();
		var areaDeptId = $("#areaDeptId").find("option:selected").val();
		var feeReportYear = $("#feeReportYear").find("option:selected").val();
		var feeReportMonth = $("#feeReportMonth").find("option:selected").val();
		if(areaId!=""&&areaDeptId!="")
		{
			var url = 'listCheckReportFeeDetail.do?feeReport.areaId='+areaId+"&feeReport.areaDeptId="+areaDeptId+"&feeReport.feeReportYear="+feeReportYear+"&feeReport.feeReportMonth="+feeReportMonth;
			
			$.get(url, {},function (data, textStatus){
				$("#sumResult").html(data);
			});
		}
	}
	
</script>

</head>
<body>
<form name="form1" id="form1"  action="addReportFeeDetail.do" method="post">
	<div id="body_div">
	<w:ShowTitle name="费用汇总上报">
	<w:TitleButton funcName="保存" onClickFunction="saveData()" urlImg="${ctx}/images/main/save.png"/>
	<w:TitleButton funcName="返回" onClickFunction="goback()" urlImg="${ctx}/images/main/back.png"/>
	</w:ShowTitle>
	<div id="body_content">
	<table width="100%">
            <tr>
              <td width="120" class="right_align">编号</td>
              <td class="left_align">
				<input type="text" id="feeReportCode" name="feeReport.feeReportCode" value="${feeReport.feeReportCode}"/>
			  </td>
			 </tr>
            <tr>
              <td width="120" class="right_align">地区</td>
              <td class="left_align">
				<input type="hidden" id="areaName" name="feeReport.areaName" value="${feeReport.areaName}"/>
				<w:select name="feeReport.areaId" styleId="areaId" value="${feeReport.areaId}" onchange="selectOption(this,'areaName')">
					<w:option optionLabel="请选择" optionValue=""></w:option>
					<w:options options="${CodeDict}" optionLabel="codeName" optionValue="codeId" filterFieldName="parentCodeId" filterFieldValue="001"></w:options>
				</w:select>
			  </td>
			 </tr>
			 <tr>
              <td class="right_align"><span class="left_align">事业部</span></td>
              <td class="left_align">
				<input type="hidden" id="areaDeptName" name="feeReport.areaDeptName" value="${feeReport.areaDeptName}"/>
              	<w:select name="feeReport.areaDeptId" styleId="areaDeptId" value="${feeReport.areaDeptId}" onchange="selectOption(this,'areaDeptName')">
					<w:option optionLabel="请选择" optionValue=""></w:option>
					<w:options options="${CodeDict}" optionLabel="codeName" optionValue="codeId" filterFieldName="parentCodeId" filterFieldValue="002"></w:options>
				</w:select>
			  </td>
			 </tr>
			<tr>
	              <td class="right_align">经手人</td>
	              <td class="left_align">
	              	${sessionScope.sessionbean.userName }
	              </td>
			</tr>
			<tr>
	              <td class="right_align">核销月份</td>
	              <td class="left_align">
	              		<select name="feeReport.feeReportYear" id="feeReportYear"  class="selectLengthAuto" onchange="sumFee()">
		      				<c:forEach begin="2013" end="${wfn:getDateTime('yyyy')}" var="year">
		      					<option value="${year}">${year}</option>
		      				</c:forEach>
		      			</select>
						<w:select name="feeReport.feeReportMonth" styleId="feeReportMonth" styleClass="selectLengthAuto" value="${wfn:getDateTime('MM')}" onchange="sumFee()">
							<w:option optionLabel="01" optionValue="01"></w:option>
							<w:option optionLabel="02" optionValue="02"></w:option>
							<w:option optionLabel="03" optionValue="03"></w:option>
							<w:option optionLabel="04" optionValue="04"></w:option>
							<w:option optionLabel="05" optionValue="05"></w:option>
							<w:option optionLabel="06" optionValue="06"></w:option>
							<w:option optionLabel="07" optionValue="07"></w:option>
							<w:option optionLabel="08" optionValue="08"></w:option>
							<w:option optionLabel="09" optionValue="09"></w:option>
							<w:option optionLabel="10" optionValue="10"></w:option>
							<w:option optionLabel="11" optionValue="11"></w:option>
							<w:option optionLabel="12" optionValue="12"></w:option>
						</w:select>
	              </td>
			</tr>
			<tr>
	              <td class="right_align">终止日期</td>
	              <td class="left_align">
	              	<input type="text" name="feeReport.endDate" value="${wfn:getDateTime('yyyy-MM-dd')}" onfocus="new WdatePicker()" readonly="readonly" class="inputCal"/>
	              </td>
			</tr>
			<tr>
	              <td class="right_align">数据上报</td>
	              <td class="left_align">
	              	<input type="radio" name="feeReport.reportState" value="已上报" checked="checked" class="radio"/>上报
	              	<input type="radio" name="feeReport.reportState" value="未上报" class="radio"/>保存，暂不上报
	              </td>
			</tr>
            
          </table>
          <div id="sumResult"></div>
	</div>
	</div>	
</form>
</body>
</html> 